package com.fg.pro.trade.controller;



import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.fg.pro.model.reponse.ResponseResult;
import com.fg.pro.trade.entity.TradeOrderDetail;
import com.fg.pro.trade.service.TradeOrderDetailService;
import com.github.pagehelper.PageInfo;
import io.swagger.v3.oas.annotations.Operation;
import jakarta.annotation.Resource;
import org.springframework.format.annotation.DateTimeFormat;
import org.springframework.web.bind.annotation.*;

import java.io.Serializable;
import java.util.Date;
import java.util.List;

/**
 * 订单详情(TradeOrderDetail)表控制层
 *
 * @author makejava
 * @since 2025-08-17 10:01:50
 */
@RestController
@RequestMapping("tradeOrderDetail")
public class TradeOrderDetailController {
    /**
     * 服务对象
     */
    @Resource
    private TradeOrderDetailService tradeOrderDetailService;

    @Operation(summary = "获取订单详情分页", description = "参数为订单号，商品名称，日期")
    @GetMapping ("/getPage")
    public ResponseResult getPage(@RequestParam(required = false, defaultValue = "1") Integer pageNum,
                                  @RequestParam(required = false, defaultValue = "10") Integer pageSize,
                                  @RequestParam(required = false) @DateTimeFormat(pattern = "yyyy-MM-dd") Date start,
                                  @RequestParam(required = false) @DateTimeFormat(pattern = "yyyy-MM-dd") Date end,
                                  @RequestParam(required = false)String orderCode,
                                  @RequestParam(required = false)String goodsName) {
        PageInfo pageInfo = tradeOrderDetailService.getPage(pageNum,pageSize,start, end,goodsName, orderCode);
        return ResponseResult.okResult(pageInfo);
    }

}

